package com.qubuyer.core.app

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
 * Author: linwg
 * Time: 2020/10/12 0012
 * Description:
 */
abstract class DataBindingFragment<V : ViewDataBinding> : BaseFragment() {

    protected lateinit var dataBinding: V

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        dataBinding = DataBindingUtil.inflate(inflater, layoutId, container, false)
        dataBinding.lifecycleOwner = this
        mRoot = dataBinding.root
        onDataBinding(dataBinding)
        return mRoot
    }

    abstract fun onDataBinding(dataBinding: V)
}